package com.sg.service.impl;

import com.sg.bean.CommodityCateGorp;
import com.sg.dao.CommodityCateGorpDao;
import com.sg.service.CommodityCateGorpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lyx
 * 商品分类业务逻辑实现
 */
@Service
public class CommodityCateGorpServiceImpl implements CommodityCateGorpService {

    @Autowired
    CommodityCateGorpDao commodityCateGorpDao;
    @Override
    public boolean add(CommodityCateGorp ccg) {
        return commodityCateGorpDao.add(ccg)>0?true:false;
    }

    @Override
    public boolean delete(int cateId) {
        return commodityCateGorpDao.delete(cateId)>0?true:false;
    }

    @Override
    public boolean update(CommodityCateGorp ccg) {
        return commodityCateGorpDao.update(ccg)>0?true:false;
    }

    @Override
    public List<CommodityCateGorp> findAll() {
        return commodityCateGorpDao.findAll();
    }

    @Override
    public CommodityCateGorp findByCateId(int cateId) {
        return commodityCateGorpDao.findByCateId(cateId);
    }

    @Override
    public List<CommodityCateGorp> findByBusinessId(int businessId) {
        return commodityCateGorpDao.findByBusinessId(businessId);
    }
}
